// -*- C++ -*-
//    FILE: absorb.cpp 
//    (C) 2001  Frank R. Schaefer
//
//    This library is free software; you can redistribute it and/or
//    modify it under the terms of the GNU Lesser General Public
//    License as published by the Free Software Foundation; either
//    version 2.1 of the License, or (at your option) any later version.
//
//    This library is distributed in the hope that it will be useful,
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
//    Lesser General Public License for more details.
//
//    You should have received a copy of the GNU Lesser General Public
//    License along with this library; if not, write to the Free Software
//    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
//////////////////////////////////////////////////////////////////////////////////////
#include<iostream>
#include<GetPot>


using namespace std;

extern "C" {
#include<math.h>
}
void print_help();

int
main(int argc, char** argv)
{
    GetPot      cl(argc, argv);
    string      base_directory = cl.follow("./", "--directory");
    GetPot      cf((base_directory + "example.pot").c_str());      // command line args

    // (1) search for multiple options with the same meaning
    if( cl.search(4, "--help", "-h", "--hilfe", "--sos") || cl.size() == 1) {
        print_help();
        exit(0);
    }

    cf.absorb(cl);

    cf.print();    
}

void
print_help()
{
    cout << endl;
    cout << "   This sample application demonstrates the 'absorb' feature of GetPot. It allows\n";
    cout << "   to combine multiple GetPot objects into a single one. All it does is to print on the \n";
    cout << "   screen the content of file 'example.pot' and the given argument on the command\n";
    cout << "   line.\n\n";
    cout << "   Giving the command option '--ok' makes it run.\n";
    cout << "\n";
}
